﻿
Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService
Partial Class Control_MSDS_Section16View
    Inherits System.Web.UI.UserControl
#Region "Sub and Function "
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Label
        Translate()
        If Not IsPostBack Then
            hidMSDSId.Value = Request("Id")
            ShowData()
        End If
    End Sub
    Protected Sub ShowData()
        Using data As New VSEntities
            Dim _lang As Integer = Session("LanguageId")
            Dim _Section16Id As Integer = (From q In data.MSDSSection16 Where q.MSDSId = hidMSDSId.Value And q.LanguageId = _lang Select q.Section16Id).FirstOrDefault
            If _Section16Id <> 0 Then
                Dim p As MSDSSection16 = (From q In data.MSDSSection16 Where q.Section16Id = _Section16Id Select q).FirstOrDefault
                If Not p Is Nothing Then
                    'txtMsdsid.Text = IIf(IsNothing(p.MSDSId) = True, "", p.MSDSId)
                    txtS1611.Text = IIf(IsNothing(p.S1611) = True, "", p.S1611)
                    txtS1621.Text = IIf(IsNothing(p.S1621) = True, "", p.S1621)
                    txtS1631.Text = IIf(IsNothing(p.S1631) = True, "", p.S1631)
                    txtS1641.Text = IIf(IsNothing(p.S1641) = True, "", p.S1641)
                    txtS1651.Text = IIf(IsNothing(p.S1651) = True, "", p.S1651)
                    txtS1661.Text = IIf(IsNothing(p.S1661) = True, "", p.S1661)
                    hidID.Value = p.Section16Id
                End If
            End If
        End Using
    End Sub

#End Region
#Region "Event for control "
    Protected Sub Translate()
        Section16lblHeader.Text = getTranslate("Section16lblHeader", Session("LanguageId"), Section16lblHeader.Text)
        lblS1611.Text = getTranslate("lblS1611", Session("LanguageId"), lblS1611.Text)
        Session16lblNgayThangBienSoanPhieu.Text = getTranslate("Session16lblNgayThangBienSoanPhieu", Session("LanguageId"), Session16lblNgayThangBienSoanPhieu.Text)
        lblS1631.Text = getTranslate("lblS1631", Session("LanguageId"), lblS1631.Text)
        lblCompany.Text = getTranslate("lblCompany", Session("LanguageId"), lblCompany.Text)
        lblExpired.Text = getTranslate("lblExpired", Session("LanguageId"), lblExpired.Text)
        lblS1611.Text = getTranslate("lblS1611", Session("LanguageId"), lblS1611.Text)

    End Sub

#End Region
End Class
